package
{
	import fl.controls.Button;
	import fl.controls.TextInput;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.system.System;
	import flash.text.TextFormat;
	
	[SWF(width=384, height=26)]
	
	public class CopyText extends Sprite
	{
		private var $_videoURL:TextInput = null;

		public function CopyText() {
			initUI();
		}

		private function initUI():void {
			$_videoURL = new TextInput();
			$_videoURL.width = 320;
			$_videoURL.editable = false;
			$_videoURL.text = loaderInfo.parameters.url;
			$_videoURL.setStyle("textFormat", new TextFormat("Verdana", 12, 0, false));
			$_videoURL.setStyle("textPadding", 2);
			addChild($_videoURL);
			$_videoURL.x = 2;
			$_videoURL.y = 2;

			var btn:Button = new Button();
			btn.width = 52;
			btn.label = "复制";
			btn.setStyle("textFormat", new TextFormat("Verdana", 12, 0, true));
			btn.addEventListener(MouseEvent.CLICK, copyButtonHandler);
			addChild(btn);
			btn.x = 332;
			btn.y = 2;
		}

		private function copyButtonHandler(e:MouseEvent):void {
			System.setClipboard($_videoURL.text);
		}
	}
}